#ifndef CONDITION_H
#define CONDITION_H
#include"mutex.h"
#include<boost/noncopyable.hpp>
namespace inm
{
	namespace concurrency
	{
		class Condition :boost::noncopyable
		{
			public:
				Condition(MutexLock& mutex) : mutex_(mutex)
				{
					pthread_cond_init(&cond_,NULL);	
				}
				~Condition()
				{
					pthread_cond_destroy(&cond_);
				}
				void wait()
				{
					pthread_cond_wait(&cond_,mutex_.getPthreadMutex());
				}
                void waitForSeconds(int seconds)
                {//struct timespect
                    //pthread_cond_timedwait()
				}
				void notify()
				{
					pthread_cond_signal(&cond_);
				}
				void notifyAll()
				{
					pthread_cond_broadcast(&cond_);
				}
			private:
				MutexLock& mutex_;
				pthread_cond_t cond_;
		};
	};
};
#endif //CONDITION_H
